<template>
    <div class>
        <Form ref="formValidate" :model="formValidate" :label-width="100" :rules="ruleInline">
            <Row>
                <Col span="24">
                    <div class="btns">
                        <Button type="primary" @click="openModal">新增申请</Button>

                    </div>
                </Col>
                <Col span="24">
                    <Row>
                        <Col :xs="24" :sm="12" :md="12" :lg="8" :xl="6" :xxl="6" >
                            <FormItem label="合同号" prop="contractNo">
                                <Input clearable v-model="formValidate.contractNo" placeholder/>
                            </FormItem>
                        </Col>
                        <Col  :xs="24" :sm="12" :md="12" :lg="8" :xl="6" :xxl="6" >
                            <FormItem label="申请编号" prop="applyNo">
                                <Input v-model="formValidate.applyNo" placeholder clearable/>
                            </FormItem>
                        </Col>
                        <Col  :xs="24" :sm="12" :md="12" :lg="8" :xl="6" :xxl="6" >
                            <FormItem label="客户姓名" prop="custName">
                                <Input clearable v-model="formValidate.custName" placeholder/>
                            </FormItem>
                        </Col>

                        <Col :xs="24" :sm="12" :md="12" :lg="8" :xl="6" :xxl="6"  >
                            <FormItem label="处理状态" prop="processStatus">
                                <Select v-model="formValidate.processStatus" placeholder="请选择" clearable>
                                    <Option v-for="(item,index) in dataDict.contractProcessStuDict" :key="index"
                                            :value="item.value">{{item.title}}
                                    </Option>
                                </Select>
                            </FormItem>
                        </Col>
                        <Col :xs="24" :sm="12" :md="12" :lg="8" :xl="6" :xxl="6" >
                            <FormItem label="申请时间" prop="applyDate">
                                <DatePicker type="daterange" @on-change="selectstartDate" format="yyyy-MM-dd"
                                            placeholder="请选择" v-model="formValidate.applyDates"></DatePicker>
                            </FormItem>
                        </Col>
                        <Col :xs="24" :sm="12" :md="12" :lg="8" :xl="6" :xxl="6" >
                            <FormItem label="合作商名称" prop="channelFullName">
                                <Input clearable v-model="formValidate.channelFullName" placeholder/>
                            </FormItem>
                        </Col>
                        <Col :xs="24" :sm="12" :md="12" :lg="8" :xl="6" :xxl="6" >
                            <FormItem label="结束时间" prop="endDate">
                                <DatePicker type="daterange" @on-change="selectendDate" format="yyyy-MM-dd"
                                            placeholder="请选择" v-model="formValidate.endDates"></DatePicker>
                            </FormItem>
                        </Col>
                        <Col :xs="24" :sm="12" :md="12" :lg="8" :xl="6" :xxl="6" >
                            <FormItem label="来源" prop="businessSource">
                                <Select v-model="formValidate.businessSource" placeholder="请选择" clearable>
                                    <Option v-for="(item,index) in dataDict.businessSourceDict" :key="index"
                                            :value="item.value">
                                        {{item.title}}
                                    </Option>
                                </Select>
                            </FormItem>
                        </Col>
                        <Col :xs="24" :sm="12" :md="12" :lg="8" :xl="6" :xxl="6" >
                            <FormItem label="渠道归属" prop="channelType">
                                <Select v-model="formValidate.channelType" placeholder="请选择" clearable>
                                    <Option v-for="(item,index) in dataDict.channelBelongDict" :key="index"
                                            :value="item.value">
                                        {{item.title}}
                                    </Option>
                                </Select>
                            </FormItem>
                        </Col>
                        <Col :xs="24" :sm="12" :md="12" :lg="8" :xl="6" :xxl="6" >
                            <Form-item label="全部案件" prop="allCase">
                                <i-switch v-model="formValidate.allCase" @on-change="getCorporateList" ></i-switch>
                            </Form-item>
                        </Col>

                    </Row>
                </Col>

                <Col span="24">
                    <div class="contract-list-btns">
                        <Button type="primary" @click="handleSubmit('formValidate')"  icon="ios-search">搜索</Button>
                        <Button type="primary" @click="handleReset('formValidate')" icon="ios-trash-outline">重置</Button>
                    </div>
                </Col>
            </Row>
        </Form>
    </div>
</template>
<script>
    import {findContractReissueList} from "_p/basic/api/contract/contract-reissue/index";
    export default {
        props: {
            formValidate: {
                type: Object,
                required: true
            },
            dataDict: {
                type: Object,
                required: true
            }
        },
        data() {
            return {
                loading: false,

                ruleInline: {}
            };
        },
        mounted() {
            this.init();
        },
        methods: {
            init() {
            },
            // 查询
            handleSubmit(name) {
                this.$refs[name].validate(valid => {
                    if (valid) {
                        this.loading = true;
                        this.$emit("getList", this.formValidate);
                    }
                });
            },
            getCorporateList() {
                this.$emit('getList',this.formValidate);
            },
            selectstartDate(v) {
                if (v) {
                    this.formValidate.startCreateDate = v[0];
                    this.formValidate.endCreateDate = v[1];
                }
            },
            selectendDate(v) {
                if (v) {
                    this.formValidate.startEndDate = v[0];
                    this.formValidate.endEndDate = v[1];
                }
            },
            handleReset(name) {
                console.log("name",name)
                this.$refs[name].resetFields();
                this.formValidate.startCreateDate = null;
                this.formValidate.endCreateDate = null;
                this.formValidate.allCase = false;
                this.formValidate.applyDates = null;
                this.formValidate.startEndDate = null;
                this.formValidate.endEndDate = null;
                this.formValidate.endDates = null;
                this.$emit("getList", this.formValidate);
            },
            openModal() {
                this.$emit("showModal");
            }
        },
        computed: {}
    };
</script>
<style>
</style>
